package com.wzj.manage.config;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LoginHandlerInterceptor implements HandlerInterceptor {
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        //登录之后应该有session
        Object mangeUser=request.getSession().getAttribute("manageUser");
        if(mangeUser==null){
            response.sendRedirect("/login.html");
            return false;
        }else {
            return true;
        }

    }
}
